package com.ruoyi.system.enumeration;

import lombok.Getter;
import lombok.AllArgsConstructor;

/**
 * 传统预定状态枚举
 */
@Getter
@AllArgsConstructor
public enum SyTraditionalReservationEnum {

    /**
     * 已取消
     */
    STATUS_WAIT_CONFIRM(1, "已取消"),

    /**
     * 已开单
     */
    STATUS_WAIT_ORDER(2, "已开单"),

    /**
     * 已预订
     */
    STATUS_WAIT_RESERVATION(3, "已预订"),



    /**
     * 已预约
     */
    ALREADY_BOOKED(4, "已预约"),
    /**
     * 已完成
     */
    COMPLETED(5, "已完成");

    private final Integer key;
    private final String value;


    public static SyTraditionalReservationEnum fromKey(Integer key) {
        for (SyTraditionalReservationEnum status : values()) {
            if (status.key.equals(key)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid key: " + key);
    }

    /**
     * 根据 key 获取对应的 value（状态描述）
     */
    public static String getValueByKey(Integer key) {
        for (SyTraditionalReservationEnum status : values()) {
            if (status.key.equals(key)) {
                return status.value;
            }
        }
        throw new IllegalArgumentException("Invalid key: " + key);
    }

}
